Chapter 6 Synchronization Tools
Chapter 6 Synchronization Tools
Background
背景
生產者
消費者
競爭條件
- count++
- fork()
- count++
The Critical-Section Problem
關鍵區域
- Example
- Example
Solution
Peterson’s Solution
sol
example
現代框架可能不適用
- 雙方都進入CS
- 雙方都進入CS
Hardware Support for Synchronization
不同processor
三種硬體支援
記憶體屏障
- Example
- method
- Example
關鍵區域以及鎖
同步硬體
test and set
- 用法
- 用法
compare and swap
- 用法
- 用法
Swap
- 用法
- 用法
上述三者仍舊不圓滿
原子變數
- increment
- increment
Mutex Locks
互斥鎖
- 說明
- 說明
定義
Semaphores
信號量
更加廣泛
實作
- 說明
- 說明
問題
Monitors
- 監視器
條件
- 條件
- 順序
- A
- B
- 結論
- 順序
Example
- Example
實現monitor
- 實現monitor
錯誤使用monitor
- 錯誤使用monitor
Liveness
死鎖
飢餓 與 優先級導置
- Some level of priority inversion can not be avoided!!
Chapter 6 Synchronization Tools
https://z-hwa.github.io/webHome/[object Object]/Operation Systems/Chapter-6-Synchronization-Tools/